// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout, PageView } from '@/layouts'
import { company } from '@/core/icons'

// const RouteView = {
//   name: 'RouteView',
//   render: h => h('router-view')
// }

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '主页' },
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/home'),
        meta: { title: '主页', keepAlive: true, icon: 'home' }
      },

      // 用户管理
      {
        path: '/users',
        name: 'User',
        redirect: '/user/list',
        component: PageView,
        meta: { title: '用户管理', keepAlive: true, icon: 'user' },
        children: [
          {
            path: '/user/list',
            name: 'UserList',
            component: () => import('@/views/user/List'),
            meta: { title: '用户列表', keepAlive: true }
          },
          {
            path: '/user/detail/:id([1-9]\\d*)',
            name: 'UserDetail',
            component: () => import('@/views/user/Detail'),
            meta: { title: '用户详情', keepAlive: true },
            hidden: true
          }
        ]
      },

      // 管理员系统
      {
        path: '/admin',
        name: 'admin',
        redirect: '/admin/list',
        component: PageView,
        meta: { title: '管理员管理', keepAlive: true, icon: 'team' },
        children: [
          // {
          //   path: '/admin/role-list',
          //   name: 'AdminRoleList',
          //   component: () => import('@/views/admin/RoleList'),
          //   meta: { title: '部门角色管理', keepAlive: true },
          //   hidden: true
          // },
          {
            path: '/admin/list',
            name: 'AdminList',
            component: () => import('@/views/admin/List'),
            meta: { title: '管理员管理', keepAlive: true }
          },
          {
            path: '/admin/add',
            name: 'AdminAdd',
            component: () => import('@/views/admin/Edit'),
            meta: { title: '新增管理员', keepAlive: true },
            hidden: true
          },
          {
            path: '/admin/edit/:id([1-9]\\d*)',
            name: 'AdminEdit',
            component: () => import('@/views/admin/Edit'),
            meta: { title: '编辑管理员', keepAlive: true },
            hidden: true
          }
          //   权限管理
          // {
          //   path: '/admin/Authority-list',
          //   name: 'AuthorityManagement',
          //   component: () => import('@/views/admin/Authoritymanagement'),
          //   meta: { title: '权限管理', keepAlive: true },
          //   hidden: true
          // }
        ]
      },

      // 组织管理
      {
        path: '/organization',
        name: 'Organization',
        redirect: '/organization/list',
        component: PageView,
        meta: { title: '组织管理', keepAlive: true, icon: company },
        children: [
          {
            path: '/organization/list',
            name: 'OrganizationList',
            component: () => import('@/views/organization/List'),
            meta: { title: '组织列表', keepAlive: true }
          },
          {
            path: '/organization/add',
            name: 'OrganizationAdd',
            component: () => import('@/views/organization/Edit'),
            meta: { title: '新增组织', keepAlive: true },
            hidden: true
          },
          {
            path: '/organization/edit/:id([1-9]\\d*)',
            name: 'OrganizationEdit',
            component: () => import('@/views/organization/Edit'),
            meta: { title: '编辑组织', keepAlive: true },
            hidden: true
          }
        ]
      },

      // 订单管理
      {
        path: '/order',
        name: 'Order',
        redirect: '/order/list',
        component: PageView,
        meta: { title: '订单管理', keepAlive: true, icon: 'table' },
        children: [
          {
            path: '/order/list',
            name: 'OrderList',
            component: () => import('@/views/order/List'),
            meta: { title: '订单列表', keepAlive: false }
          },
          {
            path: '/order/edit/:id([1-9]\\d*)',
            name: 'OrderEdit',
            component: () => import('@/views/order/Edit'),
            meta: { title: '查看/处理订单', keepAlive: false },
            hidden: true
          }
        ]
      },

      // 福利管理
      {
        path: '/goods',
        name: 'goods',
        redirect: '/goods/list',
        component: PageView,
        meta: { title: '福利管理', keepAlive: false, icon: 'shop' },
        children: [
          {
            path: '/goods/list',
            name: 'GoodsList',
            component: () => import('@/views/goods/List'),
            meta: { title: '福利列表', keepAlive: false }
          },
          {
            path: '/goods/add',
            name: 'GoodsAdd',
            component: () => import('@/views/goods/Edit'),
            meta: { title: '新增福利', keepAlive: false },
            hidden: true
          },
          {
            path: '/goods/edit/:id([1-9]\\d*)',
            name: 'GoodsEdit',
            component: () => import('@/views/goods/Edit'),
            meta: { title: '编辑福利', keepAlive: false },
            hidden: true
          }
        ]
      },

      // 题库管理
      {
        path: '/question',
        name: 'Question',
        redirect: '/question/list',
        component: PageView,
        meta: { title: '题库管理', keepAlive: true, icon: 'file-text' },
        children: [{
          path: '/question/List',
          name: 'QuestionList',
          component: () => import('@/views/question/List'),
          meta: { title: '题库列表', keepAlive: true }
        },
        {
          path: '/question/add',
          name: 'QuestionAdd',
          component: () => import('@/views/question/Edit'),
          meta: { title: '新增题库', keepAlive: true },
          hidden: true
        },
        {
          path: '/question/edit/:id([1-9]\\d*)',
          name: 'QuestionEdit',
          component: () => import('@/views/question/Edit'),
          meta: { title: '编辑题库', keepAlive: true },
          hidden: true
        }
      ]
      },
      // 轮播图管理
      {
        path: '/ads',
        name: 'Ads',
        redirect: '/ads/list',
        component: PageView,
        meta: { title: '轮播图管理', keepAlive: true, icon: 'file-image' },
        children: [
          {
            path: '/ads/list',
            name: 'AdsList',
            component: () => import('@/views/ads/List'),
            meta: { title: '轮播图列表', keepAlive: true }
          },
          {
            path: '/ads/add',
            name: 'AdsAdd',
            component: () => import('@/views/ads/Edit'),
            meta: { title: '新增轮播图', keepAlive: true },
            hidden: true
          },
          {
            path: '/ads/edit/:id([1-9]\\d*)',
            name: 'AdsEdit',
            component: () => import('@/views/ads/Edit'),
            meta: { title: '编辑轮播图', keepAlive: true },
            hidden: true
          }
        ]
      },
      // 推广管理
      {
        path: '/spread',
        name: 'Spread',
        redirect: '/spread/list',
        component: PageView,
        meta: { title: '推广链接管理', keepAlive: true, icon: 'file-image' },
        children: [
          {
            path: '/spread/list',
            name: 'SpreadList',
            component: () => import('@/views/spread/List'),
            meta: { title: '推广链接列表', keepAlive: true }
          },
          {
            path: '/spread/add',
            name: 'SpreadAdd',
            component: () => import('@/views/spread/Edit'),
            meta: { title: '新增推广链接', keepAlive: true },
            hidden: true
          },
          {
            path: '/spread/edit/:id([1-9]\\d*)',
            name: 'SpreadEdit',
            component: () => import('@/views/spread/Edit'),
            meta: { title: '编辑推广链接', keepAlive: true },
            hidden: true
          }
        ]
      },
      // 活动列表
      {
        path: '/activity',
        redirect: '/activity/list',
        component: PageView,
        meta: { title: '活动管理', keepAlive: true, icon: 'form' },
        children: [
          {
            path: '/activity/list',
            name: 'ActivityList',
            component: () => import('@/views/activity/List'),
            meta: { title: '活动列表', keepAlive: true }
          },
          {
            path: '/activity/sign-list/:id([1-9]\\d*)',
            name: 'ActivitySignList',
            component: () => import('@/views/activity/SignupList'),
            meta: { title: '活动报名列表', keepAlive: true },
            hidden: true
          },
          {
            path: '/activity/add',
            name: 'ActivityAdd',
            component: () => import('@/views/activity/Edit'),
            meta: { title: '新增活动', keepAlive: true },
            hidden: true
          },
          {
            path: '/activity/edit/:id([1-9]\\d*)',
            name: 'ActivityEdit',
            component: () => import('@/views/activity/Edit'),
            meta: { title: '编辑活动', keepAlive: true },
            hidden: true
          }
        ]
      },
      // 志愿广东管理
      {
        path: '/gdzyz',
        redirect: '/gdzyz/list',
        component: PageView,
        meta: { title: '志愿广东管理', keepAlive: true, icon: 'form' },
        children: [
          {
            path: '/gdzyz/activity/list',
            name: 'GdActivityList',
            component: () => import('@/views/gdzyz/ActivityList'),
            meta: { title: '活动列表', keepAlive: true }
          },
          {
            path: '/gdzyz/school/list',
            name: 'GdSchoolList',
            component: () => import('@/views/gdzyz/SchoolList'),
            meta: { title: '学校管理', keepAlive: true }
          },
          {
            path: '/gdzyz/school/add',
            name: 'GdSchoolAdd',
            component: () => import('@/views/gdzyz/SchoolEdit'),
            meta: { title: '新增学校', keepAlive: true },
            hidden: true
          },
          {
            path: '/gdzyz/school/edit/:id([1-9]\\d*)',
            name: 'GdSchoolEdit',
            component: () => import('@/views/gdzyz/SchoolEdit'),
            meta: { title: '编辑学校', keepAlive: true },
            hidden: true
          },
          {
            path: '/gdzyz/config',
            name: 'GdConfig',
            component: () => import('@/views/gdzyz/Config'),
            meta: { title: '配置管理', keepAlive: true }
          }
        ]
      },

      // 聚推客管理
      {
        path: '/jutuike',
        name: 'jutuike',
        redirect: '/jutuike/act-list',
        component: PageView,
        meta: { title: '聚推客管理', keepAlive: false, icon: 'account-book' },
        children: [
          // {
          //   path: '/jutuike/act',
          //   name: 'JutuikeAct',
          //   redirect: '/jutuike/act-list',
          //   meta: { title: '活动管理', keepAlive: false },
          //   children: [
          //     {
          //       path: '/jutuike/act-list',
          //       name: 'JutuikeActList',
          //       component: () => import('@/views/jutuike/activity/List'),
          //       meta: { title: '活动列表', keepAlive: false }
          //     },
          //     {
          //       path: '/jutuike/act-edit/:id([1-9]\\d*)',
          //       name: 'JutuikeActEdit',
          //       component: () => import('@/views/jutuike/activity/Edit'),
          //       meta: { title: '编辑活动', keepAlive: true },
          //       hidden: true
          //     }
          //   ]
          // },
          {
            path: '/jutuike/act-list',
            name: 'JutuikeActList',
            component: () => import('@/views/jutuike/activity/List'),
            meta: { title: '活动管理', keepAlive: false }
          },
          {
            path: '/jutuike/act-edit/:id([0-9]\\d*)',
            name: 'JutuikeActEdit',
            component: () => import('@/views/jutuike/activity/Edit'),
            meta: { title: '编辑活动', keepAlive: true },
            hidden: true
          },
          {
            path: '/jutuike/order-list',
            name: 'JutuikeOrderList',
            component: () => import('@/views/jutuike/order/List'),
            meta: { title: '订单管理', keepAlive: false }
          }
        ]
      },
      // 系统配置
      {
        path: '/system',
        name: 'SystemConfig',
        component: () => import('@/views/system/Config'),
        meta: { title: '系统配置', keepAlive: true, icon: 'setting' }
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
